﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.Master" AutoEventWireup="true" CodeBehind="subject_page.aspx.cs" Inherits="RC1.admin.subject_page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h3>Stovna lærugrein</h3>
    <asp:FormView ID="FormView1" runat="server" DataKeyNames="subject_id" 
        DataSourceID="SqlDataSource1" DefaultMode="Insert">
        <EditItemTemplate>
            subject_id:
            <asp:Label ID="subject_idLabel1" runat="server" 
                Text='<%# Eval("subject_id") %>' />
            <br />
            subject_name:
            <asp:TextBox ID="subject_nameTextBox" runat="server" 
                Text='<%# Bind("subject_name") %>' />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Update" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </EditItemTemplate>
        <InsertItemTemplate>
            Lærugrein:
            <asp:TextBox ID="subject_nameTextBox" runat="server" 
                Text='<%# Bind("subject_name") %>' />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Innset" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Angra" />
        </InsertItemTemplate>
        <ItemTemplate>
            subject_id:
            <asp:Label ID="subject_idLabel" runat="server" 
                Text='<%# Eval("subject_id") %>' />
            <br />
            subject_name:
            <asp:Label ID="subject_nameLabel" runat="server" 
                Text='<%# Bind("subject_name") %>' />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Edit" />
            &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                CommandName="Delete" Text="Delete" />
            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="New" />
        </ItemTemplate>
    </asp:FormView>
    <br />
    <hr />
    <h3>Yvirlit</h3>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="subject_id" DataSourceID="SqlDataSource1" 
        EmptyDataText="There are no data records to display." CellPadding="5">
        <Columns>
            <asp:BoundField DataField="subject_id" HeaderText="subject_id" ReadOnly="True" 
                SortExpression="subject_id" Visible="False" />
            <asp:BoundField DataField="subject_name" HeaderText="Lærugrein" 
                SortExpression="subject_name" />
            <asp:CommandField ShowEditButton="True" CancelText="Angra" DeleteText="Strika" 
                EditText="Broyt" UpdateText="Dagfør" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:tsu2011db4ConnectionString1 %>" 
        DeleteCommand="DELETE FROM [subject] WHERE [subject_id] = @subject_id" 
        InsertCommand="INSERT INTO [subject] ([subject_name]) VALUES (@subject_name)" 
        ProviderName="<%$ ConnectionStrings:tsu2011db4ConnectionString1.ProviderName %>" 
        SelectCommand="SELECT [subject_id], [subject_name] FROM [subject]" 
        UpdateCommand="UPDATE [subject] SET [subject_name] = @subject_name WHERE [subject_id] = @subject_id">
        <DeleteParameters>
            <asp:Parameter Name="subject_id" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="subject_name" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="subject_name" Type="String" />
            <asp:Parameter Name="subject_id" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
